package com.afc.struts.attribute;

import java.util.HashMap;
import java.util.Map;

public interface Attribute
{
  public String getName();
  public Class getType();

  public String getProperty(String aName);
  public void setProperty(String aName, String aProperty);

  public class DefaultAttribute implements Attribute
  {
    public DefaultAttribute(String aName, Class aType)
    {
      name = aName;
      type = aType;
    }

    @Override
    public String getName()
    {
      return name;
    }

    @Override
    public Class getType()
    {
      return type;
    }

    @Override
    public String getProperty(String aName)
    {
      return properties.get(aName);
    }

    @Override
    public void setProperty(String aName, String aProperty)
    {
      properties.put(aName, aProperty);
    }

    protected String name;
    protected Class type;
    protected Map<String, String> properties = new HashMap<>();
  }
}
